/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pe.gob.fonafe.dao.impl.stored;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Types;
import java.util.HashMap;
import java.util.Map;
import javax.sql.DataSource;
import oracle.jdbc.OracleTypes;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.jdbc.core.SqlOutParameter;
import org.springframework.jdbc.object.StoredProcedure;
import pe.gob.fonafe.domain.PerfilBean;
/**
 *
 * @author Irving
 */
public class ListarPerfilesSP extends StoredProcedure{
     private static final String PROC_PARAM ="USERADMIN.P_OBT_LIST_PERFILES";
              
    public ListarPerfilesSP(DataSource ds) {
        super(ds,PROC_PARAM);
        declareParameter(new SqlOutParameter("cCursor", OracleTypes.CURSOR,new ListarPerfilesRowMapper()));
        compile();
    }
    
    public Map execute() {
        Map inputs = new HashMap();
        return super.execute(inputs);
    }
    
    private static class ListarPerfilesRowMapper implements RowMapper<PerfilBean>{
   
        public PerfilBean mapRow(ResultSet rs, int rowNum) throws SQLException {
            PerfilBean bean = new PerfilBean();
            bean.setId_perfil(rs.getInt("id_perfil"));
            bean.setTipoPerfil(rs.getString("tipoPerfil"));
            return bean;
        }
    }
}
